﻿using System; 
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic; 
using System.Data;
using DBUtility;

namespace XQ.SP.DalServices  
{
	 	//销售属性类型复制
		public partial class ShopProduceSaleAttributeTypeCopyDal : BaseDal
	{
   		     
		public bool ExistsWhere(string whereSql)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from ShopProduceSaleAttributeTypeCopy");
            if (whereSql != "")
            {
                strSql.Append(" where " + whereSql);
            }
			
			return DbHelperSQL.Exists(strSql.ToString());
		}
		public bool Exists(long id)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from [ShopProduceSaleAttributeTypeCopy]");
			strSql.Append(" where  [Id]=@Id ");
			SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.BigInt)
			};
			parameters[0].Value = id;
			return DbHelperSQL.Exists(strSql.ToString(),parameters);
		}
		
				
		
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public long Add(XQ.SP.Model.ShopProduceSaleAttributeTypeCopyItem model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into [ShopProduceSaleAttributeTypeCopy](");			
            strSql.Append("[Name],[ShopTypeId],[ParentId],[SubIds],[Sort],[Alias],[IsColor],[IsTextBox],[IsKey],[Type],[IsSale],[Status],[Creator],[Created],[Modifier],[Modified]");
			strSql.Append(") values (");
            strSql.Append("@Name,@ShopTypeId,@ParentId,@SubIds,@Sort,@Alias,@IsColor,@IsTextBox,@IsKey,@Type,@IsSale,@Status,@Creator,@Created,@Modifier,@Modified");            
            strSql.Append(") ");            
            strSql.Append(";select @@IDENTITY");		
			SqlParameter[] parameters = {
			            new SqlParameter("@Name", SqlDbType.NVarChar,40) ,            
                        new SqlParameter("@ShopTypeId", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@ParentId", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@SubIds", SqlDbType.NVarChar,100) ,            
                        new SqlParameter("@Sort", SqlDbType.Int,4) ,            
                        new SqlParameter("@Alias", SqlDbType.NVarChar,100) ,            
                        new SqlParameter("@IsColor", SqlDbType.Int,4) ,            
                        new SqlParameter("@IsTextBox", SqlDbType.Int,4) ,            
                        new SqlParameter("@IsKey", SqlDbType.Int,4) ,            
                        new SqlParameter("@Type", SqlDbType.Int,4) ,            
                        new SqlParameter("@IsSale", SqlDbType.Int,4) ,            
                        new SqlParameter("@Status", SqlDbType.Int,4) ,            
                        new SqlParameter("@Creator", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@Created", SqlDbType.DateTime) ,            
                        new SqlParameter("@Modifier", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@Modified", SqlDbType.DateTime)             
              
            };
			            
            parameters[0].Value = model.Name;                        
            parameters[1].Value = model.ShopTypeId;                        
            parameters[2].Value = model.ParentId;                        
            parameters[3].Value = model.SubIds;                        
            parameters[4].Value = model.Sort;                        
            parameters[5].Value = model.Alias;                        
            parameters[6].Value = model.IsColor;                        
            parameters[7].Value = model.IsTextBox;                        
            parameters[8].Value = model.IsKey;                        
            parameters[9].Value = model.Type;                        
            parameters[10].Value = model.IsSale;                        
            parameters[11].Value = model.Status;                        
            parameters[12].Value = model.Creator;                        
            parameters[13].Value = model.Created;                        
            parameters[14].Value = model.Modifier;                        
            parameters[15].Value = model.Modified;                        
			   
			object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);			
			if (obj == null)
			{
				return 0;
			}
			else
			{
				                                    
            	return Convert.ToInt64(obj);
                                                  
			}			   
            			
		}
		
		/// <summary>
		///   批量添加数据
		/// </summary>
		public int AddList(List<XQ.SP.Model.ShopProduceSaleAttributeTypeCopyItem> models)
		{
			List<CommandInfo> commands = new List<CommandInfo>();
			foreach(XQ.SP.Model.ShopProduceSaleAttributeTypeCopyItem item in models)
			{
				CommandInfo command = new CommandInfo();
				StringBuilder strSql=new StringBuilder();
				strSql.Append("insert into [ShopProduceSaleAttributeTypeCopy](");			
	            strSql.Append("[Name],[ShopTypeId],[ParentId],[SubIds],[Sort],[Alias],[IsColor],[IsTextBox],[IsKey],[Type],[IsSale],[Status],[Creator],[Created],[Modifier],[Modified]");
				strSql.Append(") values (");
	            strSql.Append("@Name,@ShopTypeId,@ParentId,@SubIds,@Sort,@Alias,@IsColor,@IsTextBox,@IsKey,@Type,@IsSale,@Status,@Creator,@Created,@Modifier,@Modified");            
	            strSql.Append(") ");            
	            strSql.Append(";select @@IDENTITY");		
				SqlParameter[] parameters = {
					            new SqlParameter("@Name", SqlDbType.NVarChar,40) ,            
	            	            new SqlParameter("@ShopTypeId", SqlDbType.BigInt,8) ,            
	            	            new SqlParameter("@ParentId", SqlDbType.BigInt,8) ,            
	            	            new SqlParameter("@SubIds", SqlDbType.NVarChar,100) ,            
	            	            new SqlParameter("@Sort", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@Alias", SqlDbType.NVarChar,100) ,            
	            	            new SqlParameter("@IsColor", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@IsTextBox", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@IsKey", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@Type", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@IsSale", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@Status", SqlDbType.Int,4) ,            
	            	            new SqlParameter("@Creator", SqlDbType.BigInt,8) ,            
	            	            new SqlParameter("@Created", SqlDbType.DateTime) ,            
	            	            new SqlParameter("@Modifier", SqlDbType.BigInt,8) ,            
	            	            new SqlParameter("@Modified", SqlDbType.DateTime)             
	              
	            };
	            				            
	            parameters[0].Value = item.Name;	                        
	            parameters[1].Value = item.ShopTypeId;	                        
	            parameters[2].Value = item.ParentId;	                        
	            parameters[3].Value = item.SubIds;	                        
	            parameters[4].Value = item.Sort;	                        
	            parameters[5].Value = item.Alias;	                        
	            parameters[6].Value = item.IsColor;	                        
	            parameters[7].Value = item.IsTextBox;	                        
	            parameters[8].Value = item.IsKey;	                        
	            parameters[9].Value = item.Type;	                        
	            parameters[10].Value = item.IsSale;	                        
	            parameters[11].Value = item.Status;	                        
	            parameters[12].Value = item.Creator;	                        
	            parameters[13].Value = item.Created;	                        
	            parameters[14].Value = item.Modifier;	                        
	            parameters[15].Value = item.Modified;	            	            
	         	command.CommandText = strSql.ToString();
	         	command.Parameters = parameters;
	         	
	         	commands.Add(command);
	         }
            
			object obj = DbHelperSQL.ExecuteSqlTran(commands);			
			if (obj == null)
			{
				return 0;
			}
			else
			{
            	return Convert.ToInt32(obj);
			}
			
           
		}
		
		
		/// <summary>
		/// 批量更新数据
		/// </summary>
		public int UpdateList(List<XQ.SP.Model.ShopProduceSaleAttributeTypeCopyItem> models)
		{
			List<CommandInfo> commands = new List<CommandInfo>();
			CommandInfo command = new CommandInfo();
			
			foreach(XQ.SP.Model.ShopProduceSaleAttributeTypeCopyItem item in models)
			{
					StringBuilder strSql=new StringBuilder();
					strSql.Append("update [ShopProduceSaleAttributeTypeCopy] set ");
							            		            		                        
		            strSql.Append(" [Name] = @Name , ");		            		                        
		            strSql.Append(" [ShopTypeId] = @ShopTypeId , ");		            		                        
		            strSql.Append(" [ParentId] = @ParentId , ");		            		                        
		            strSql.Append(" [SubIds] = @SubIds , ");		            		                        
		            strSql.Append(" [Sort] = @Sort , ");		            		                        
		            strSql.Append(" [Alias] = @Alias , ");		            		                        
		            strSql.Append(" [IsColor] = @IsColor , ");		            		                        
		            strSql.Append(" [IsTextBox] = @IsTextBox , ");		            		                        
		            strSql.Append(" [IsKey] = @IsKey , ");		            		                        
		            strSql.Append(" [Type] = @Type , ");		            		                        
		            strSql.Append(" [IsSale] = @IsSale , ");		            		                        
		            strSql.Append(" [Status] = @Status , ");		            		                        
		            strSql.Append(" [Creator] = @Creator , ");		            		                        
		            strSql.Append(" [Created] = @Created , ");		            		                        
		            strSql.Append(" [Modifier] = @Modifier , ");		            		                        
		            strSql.Append(" [Modified] = @Modified  ");		            			
					strSql.Append(" where [Id]=@Id ");
								
					SqlParameter[] parameters = {
							            new SqlParameter("@Id", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@Name", SqlDbType.NVarChar,40) ,		            
		            		            new SqlParameter("@ShopTypeId", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@ParentId", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@SubIds", SqlDbType.NVarChar,100) ,		            
		            		            new SqlParameter("@Sort", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@Alias", SqlDbType.NVarChar,100) ,		            
		            		            new SqlParameter("@IsColor", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@IsTextBox", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@IsKey", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@Type", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@IsSale", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@Status", SqlDbType.Int,4) ,		            
		            		            new SqlParameter("@Creator", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@Created", SqlDbType.DateTime) ,		            
		            		            new SqlParameter("@Modifier", SqlDbType.BigInt,8) ,		            
		            		            new SqlParameter("@Modified", SqlDbType.DateTime) 		            
		              
		            };
		            					            
		            parameters[0].Value = item.Id;		                        
		            parameters[1].Value = item.Name;		                        
		            parameters[2].Value = item.ShopTypeId;		                        
		            parameters[3].Value = item.ParentId;		                        
		            parameters[4].Value = item.SubIds;		                        
		            parameters[5].Value = item.Sort;		                        
		            parameters[6].Value = item.Alias;		                        
		            parameters[7].Value = item.IsColor;		                        
		            parameters[8].Value = item.IsTextBox;		                        
		            parameters[9].Value = item.IsKey;		                        
		            parameters[10].Value = item.Type;		                        
		            parameters[11].Value = item.IsSale;		                        
		            parameters[12].Value = item.Status;		                        
		            parameters[13].Value = item.Creator;		                        
		            parameters[14].Value = item.Created;		                        
		            parameters[15].Value = item.Modifier;		                        
		            parameters[16].Value = item.Modified;		            		            
	            command.CommandText = strSql.ToString();
	         	command.Parameters = parameters;
	         	commands.Add(command);
	         }
            
            int rows=DbHelperSQL.ExecuteSqlTran(commands);
			return rows;

		}
		
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(XQ.SP.Model.ShopProduceSaleAttributeTypeCopyItem model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update [ShopProduceSaleAttributeTypeCopy] set ");
			                                                
            strSql.Append(" [Name] = @Name , ");                                    
            strSql.Append(" [ShopTypeId] = @ShopTypeId , ");                                    
            strSql.Append(" [ParentId] = @ParentId , ");                                    
            strSql.Append(" [SubIds] = @SubIds , ");                                    
            strSql.Append(" [Sort] = @Sort , ");                                    
            strSql.Append(" [Alias] = @Alias , ");                                    
            strSql.Append(" [IsColor] = @IsColor , ");                                    
            strSql.Append(" [IsTextBox] = @IsTextBox , ");                                    
            strSql.Append(" [IsKey] = @IsKey , ");                                    
            strSql.Append(" [Type] = @Type , ");                                    
            strSql.Append(" [IsSale] = @IsSale , ");                                    
            strSql.Append(" [Status] = @Status , ");                                    
            strSql.Append(" [Creator] = @Creator , ");                                    
            strSql.Append(" [Created] = @Created , ");                                    
            strSql.Append(" [Modifier] = @Modifier , ");                                    
            strSql.Append(" [Modified] = @Modified  ");            			
			strSql.Append(" where [Id]=@Id  ");
						
			SqlParameter[] parameters = {
			            new SqlParameter("@Id", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@Name", SqlDbType.NVarChar,40) ,            
                        new SqlParameter("@ShopTypeId", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@ParentId", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@SubIds", SqlDbType.NVarChar,100) ,            
                        new SqlParameter("@Sort", SqlDbType.Int,4) ,            
                        new SqlParameter("@Alias", SqlDbType.NVarChar,100) ,            
                        new SqlParameter("@IsColor", SqlDbType.Int,4) ,            
                        new SqlParameter("@IsTextBox", SqlDbType.Int,4) ,            
                        new SqlParameter("@IsKey", SqlDbType.Int,4) ,            
                        new SqlParameter("@Type", SqlDbType.Int,4) ,            
                        new SqlParameter("@IsSale", SqlDbType.Int,4) ,            
                        new SqlParameter("@Status", SqlDbType.Int,4) ,            
                        new SqlParameter("@Creator", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@Created", SqlDbType.DateTime) ,            
                        new SqlParameter("@Modifier", SqlDbType.BigInt,8) ,            
                        new SqlParameter("@Modified", SqlDbType.DateTime)             
              
            };
            			            
            parameters[0].Value = model.Id;                        
            parameters[1].Value = model.Name;                        
            parameters[2].Value = model.ShopTypeId;                        
            parameters[3].Value = model.ParentId;                        
            parameters[4].Value = model.SubIds;                        
            parameters[5].Value = model.Sort;                        
            parameters[6].Value = model.Alias;                        
            parameters[7].Value = model.IsColor;                        
            parameters[8].Value = model.IsTextBox;                        
            parameters[9].Value = model.IsKey;                        
            parameters[10].Value = model.Type;                        
            parameters[11].Value = model.IsSale;                        
            parameters[12].Value = model.Status;                        
            parameters[13].Value = model.Creator;                        
            parameters[14].Value = model.Created;                        
            parameters[15].Value = model.Modifier;                        
            parameters[16].Value = model.Modified;                        
            int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		
		
		
		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(long Id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from ShopProduceSaleAttributeTypeCopy ");
			strSql.Append(" where Id=@Id  ");
						SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.BigInt)
			};
			parameters[0].Value = Id;


			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		
				/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool DeleteList(string Idlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from ShopProduceSaleAttributeTypeCopy ");
			strSql.Append(" where Id in ("+Idlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
				
		
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public XQ.SP.Model.ShopProduceSaleAttributeTypeCopyItem GetModel(long Id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select Id, Name, ShopTypeId, ParentId, SubIds, Sort, Alias, IsColor, IsTextBox, IsKey, Type, IsSale, Status, Creator, Created, Modifier, Modified  ");			
			strSql.Append("  from ShopProduceSaleAttributeTypeCopy ");
			strSql.Append(" where Id=@Id  ");
						SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.BigInt)
			};
			parameters[0].Value = Id;

			
			XQ.SP.Model.ShopProduceSaleAttributeTypeCopyItem model=new XQ.SP.Model.ShopProduceSaleAttributeTypeCopyItem();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			
			if(ds.Tables[0].Rows.Count>0)
			{
												if(ds.Tables[0].Rows[0]["Id"].ToString()!="")
				{
					model.Id=long.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
				}
																																				model.Name= ds.Tables[0].Rows[0]["Name"].ToString();
																												if(ds.Tables[0].Rows[0]["ShopTypeId"].ToString()!="")
				{
					model.ShopTypeId=long.Parse(ds.Tables[0].Rows[0]["ShopTypeId"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["ParentId"].ToString()!="")
				{
					model.ParentId=long.Parse(ds.Tables[0].Rows[0]["ParentId"].ToString());
				}
																																				model.SubIds= ds.Tables[0].Rows[0]["SubIds"].ToString();
																												if(ds.Tables[0].Rows[0]["Sort"].ToString()!="")
				{
					model.Sort=int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
				}
																																				model.Alias= ds.Tables[0].Rows[0]["Alias"].ToString();
																												if(ds.Tables[0].Rows[0]["IsColor"].ToString()!="")
				{
					model.IsColor=int.Parse(ds.Tables[0].Rows[0]["IsColor"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["IsTextBox"].ToString()!="")
				{
					model.IsTextBox=int.Parse(ds.Tables[0].Rows[0]["IsTextBox"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["IsKey"].ToString()!="")
				{
					model.IsKey=int.Parse(ds.Tables[0].Rows[0]["IsKey"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Type"].ToString()!="")
				{
					model.Type=int.Parse(ds.Tables[0].Rows[0]["Type"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["IsSale"].ToString()!="")
				{
					model.IsSale=int.Parse(ds.Tables[0].Rows[0]["IsSale"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Status"].ToString()!="")
				{
					model.Status=int.Parse(ds.Tables[0].Rows[0]["Status"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Creator"].ToString()!="")
				{
					model.Creator=long.Parse(ds.Tables[0].Rows[0]["Creator"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Created"].ToString()!="")
				{
					model.Created=DateTime.Parse(ds.Tables[0].Rows[0]["Created"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Modifier"].ToString()!="")
				{
					model.Modifier=long.Parse(ds.Tables[0].Rows[0]["Modifier"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Modified"].ToString()!="")
				{
					model.Modified=DateTime.Parse(ds.Tables[0].Rows[0]["Modified"].ToString());
				}
																														
				return model;
			}
			else
			{
				return null;
			}
		}
		
		
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public XQ.SP.Model.ShopProduceSaleAttributeTypeCopyItem GetModelWhereStr(string whereStr)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select Id, Name, ShopTypeId, ParentId, SubIds, Sort, Alias, IsColor, IsTextBox, IsKey, Type, IsSale, Status, Creator, Created, Modifier, Modified  ");			
			strSql.Append("  from ShopProduceSaleAttributeTypeCopy ");
            if (whereStr != "")
            {
                strSql.Append(" where "+whereStr);
            }
			
			XQ.SP.Model.ShopProduceSaleAttributeTypeCopyItem model=new XQ.SP.Model.ShopProduceSaleAttributeTypeCopyItem();
			DataSet ds=DbHelperSQL.Query(strSql.ToString());
			
			if(ds.Tables[0].Rows.Count>0)
			{
												if(ds.Tables[0].Rows[0]["Id"].ToString()!="")
				{
					model.Id=long.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
				}
																																				model.Name= ds.Tables[0].Rows[0]["Name"].ToString();
																												if(ds.Tables[0].Rows[0]["ShopTypeId"].ToString()!="")
				{
					model.ShopTypeId=long.Parse(ds.Tables[0].Rows[0]["ShopTypeId"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["ParentId"].ToString()!="")
				{
					model.ParentId=long.Parse(ds.Tables[0].Rows[0]["ParentId"].ToString());
				}
																																				model.SubIds= ds.Tables[0].Rows[0]["SubIds"].ToString();
																												if(ds.Tables[0].Rows[0]["Sort"].ToString()!="")
				{
					model.Sort=int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
				}
																																				model.Alias= ds.Tables[0].Rows[0]["Alias"].ToString();
																												if(ds.Tables[0].Rows[0]["IsColor"].ToString()!="")
				{
					model.IsColor=int.Parse(ds.Tables[0].Rows[0]["IsColor"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["IsTextBox"].ToString()!="")
				{
					model.IsTextBox=int.Parse(ds.Tables[0].Rows[0]["IsTextBox"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["IsKey"].ToString()!="")
				{
					model.IsKey=int.Parse(ds.Tables[0].Rows[0]["IsKey"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Type"].ToString()!="")
				{
					model.Type=int.Parse(ds.Tables[0].Rows[0]["Type"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["IsSale"].ToString()!="")
				{
					model.IsSale=int.Parse(ds.Tables[0].Rows[0]["IsSale"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Status"].ToString()!="")
				{
					model.Status=int.Parse(ds.Tables[0].Rows[0]["Status"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Creator"].ToString()!="")
				{
					model.Creator=long.Parse(ds.Tables[0].Rows[0]["Creator"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Created"].ToString()!="")
				{
					model.Created=DateTime.Parse(ds.Tables[0].Rows[0]["Created"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Modifier"].ToString()!="")
				{
					model.Modifier=long.Parse(ds.Tables[0].Rows[0]["Modifier"].ToString());
				}
																																if(ds.Tables[0].Rows[0]["Modified"].ToString()!="")
				{
					model.Modified=DateTime.Parse(ds.Tables[0].Rows[0]["Modified"].ToString());
				}
																														
				return model;
			}
			else
			{
				return null;
			}
		}
		
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select * ");
			strSql.Append(" FROM ShopProduceSaleAttributeTypeCopy ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}
		
		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" * ");
			strSql.Append(" FROM ShopProduceSaleAttributeTypeCopy ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}
		
	}
}

